package edu.sctu.practice.class02.hujie.cgs.assign01;

/**
 * Created by user14 on 2015/9/24.
 */
public class Calculator {

    float weight;
    float lenght;
    String name;
    String color;
    boolean dianli;

    public float gongneng(float numOne, float numTwo, String type) {

        float result = 0;

        switch (type) {
            case "+":
                result = numOne + numTwo;
                break;
            case "-":
                result = numOne - numTwo;
                break;
            case "*":
                result = numOne * numTwo;
                break;
            case "/":
                try{
                result = numOne / numTwo;
                }catch (Exception e){
                    e.getCause();
                }
                break;
            default:
                break;
        }
        return result;
    }

    public void electricize() {
        System.out.println("能太阳能充电");
    }
}



